{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "36722953",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "from matplotlib import pyplot as plt\n",
    "import statsmodels.formula.api as smf\n",
    "from toolz import *"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "22f4484b",
   "metadata": {},
   "source": [
    "# Why Prediction Metrics are Dangerous For Causal Models\n",
    " \n",
    "A common misconception I often hear is that, if we have random data, to evaluate a causal model we could just evaluate the predictive performance of such model on the random dataset, using a metric like $R^2$. Unfortunately things are not that simple and I'll try to explain why. \n",
    " \n",
    "Generally speaking, we can say any outcome is a function of the treatment and covariates\n",
    " \n",
    "$$\n",
    "Y = F(x, t)\n",
    "$$\n",
    " \n",
    "Let's say we can decompose this function into two additive pieces. One piece that doesn't depend on the treatment and another that depends only on the treatment and possible interactions.\n",
    " \n",
    "$$\n",
    "Y = g(x) + f(t,x)\n",
    "$$\n",
    " \n",
    "This additive structure places some restriction on the functional form but not much, so we can argue it is a pretty general way of describing a Data Generating Process (DGP).\n",
    " \n",
    "The point is that if the treatment effect is weaker than the covariates effect, then, **even if we have random data**, we can have a model which has higher predictive power but is bad for causal inference. All that model has to do is approximate $g(x)$ while disregarding $f(t,x)$.\n",
    " \n",
    "In other words, **predictive performance on a random dataset does not translate our preference for how good a model is for causal inference**.\n",
    " \n",
    "To show that, let's use some simulated data.\n",
    " \n",
    "## Simulating Data\n",
    " \n",
    "In the following DGP, we have covariates $X$ that have a high predictive power but don't interact with the treatment. In other words, they don't dictate the treatment effect heterogeneity. We also have features $W$ that only impact the outcome through the treatment (are not confounders). Since the treatment has low predictive power, $W$ also doesn't have much predictive power.\n",
    " \n",
    "$$\n",
    "Y_i = g(X_i) + f(T_i,W_i) + e_i\n",
    "$$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "fe6e5192",
   "metadata": {},
   "outputs": [],
   "source": [
    "n = 100000\n",
    "n_features = 20\n",
    "n_heter = 10\n",
    "\n",
    "np.random.seed(12321)\n",
    "\n",
    "X = np.random.normal(1, 10, (n, n_features))\n",
    "nuisance = np.random.uniform(-1,1, (n_features, 1))\n",
    "\n",
    "W = np.random.normal(1, 10, (n, n_heter))\n",
    "heter_y = np.random.uniform(-1,1, (n_heter, 1))\n",
    "\n",
    "T = np.random.normal(10, 2, (n, 1)) # T is random!\n",
    "Y = np.random.normal(T + T*W.dot(heter_y) + 20*X.dot(nuisance), 0.1)\n",
    "\n",
    "df = pd.concat([\n",
    "    pd.DataFrame(X, columns=[f\"f{f}\" for f in range(n_features)]),\n",
    "    pd.DataFrame(W, columns=[f\"w{f}\" for f in range(n_heter)])\n",
    "], axis=1).assign(T=T, Y=Y)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e943c9d8",
   "metadata": {},
   "source": [
    "Now, let's break that dataset into a training and a test set"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "48674d02",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "((50000, 32), (50000, 32))"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.model_selection import train_test_split\n",
    "\n",
    "train, test = train_test_split(df, test_size=0.5)\n",
    "train.shape, test.shape"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c85db5a8",
   "metadata": {},
   "source": [
    "and train two models for treatment effect heterogeneity, $M1$ and $M2$. $M1$ will include the highly predictive features that don't affect the treatment heterogeneity and $M2$ will include the low predictive features that do affect treatment heterogeneity."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "12490bcf",
   "metadata": {},
   "outputs": [],
   "source": [
    "m1 = smf.ols(\"Y~T*(\" + \"+\".join([f\"f{f}\" for f in range(n_features)])+\")\", data=df).fit()\n",
    "m2 = smf.ols(\"Y~T*(\" + \"+\".join([f\"w{f}\" for f in range(n_heter)])+\")\", data=df).fit()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "642418c0",
   "metadata": {},
   "source": [
    "If we look at the predictive power of both models using the $R^2$, indeed, $M1$ is much better than $M2$. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "5b4facc6",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "M1: 0.9160516511287358\n",
      "M2: 0.08378351037639298\n"
     ]
    }
   ],
   "source": [
    "from sklearn.metrics import r2_score\n",
    "\n",
    "print(\"M1:\", r2_score(test[\"Y\"], m1.predict(test)))\n",
    "print(\"M2:\", r2_score(test[\"Y\"], m2.predict(test)))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0e2c5510",
   "metadata": {},
   "source": [
    "Now, let's calculate the cumulative elasticity curve for both models. For that, we will need Conditional Average Treatment Effect predictions. Since all the models here are linear, we can use the following formula to get CATE predictions\n",
    " \n",
    "$$\n",
    "\\hat{CATE_i} = M(X, W, t) - M(X, W, t-1)\n",
    "$$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "1afeeee1",
   "metadata": {},
   "outputs": [],
   "source": [
    "@curry\n",
    "def elast(data, y, t):\n",
    "        return (np.sum((data[t] - data[t].mean())*(data[y] - data[y].mean())) /\n",
    "                np.sum((data[t] - data[t].mean())**2))\n",
    "    \n",
    "\n",
    "def cumulative_gain(dataset, prediction, y, t, min_periods=30, steps=100):\n",
    "    size = dataset.shape[0]\n",
    "    ordered_df = dataset.sort_values(prediction, ascending=False).reset_index(drop=True)\n",
    "    n_rows = list(range(min_periods, size, size // steps)) + [size]\n",
    "    return np.array([elast(ordered_df.head(rows), y, t) * (rows/size) for rows in n_rows])\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "4261421b",
   "metadata": {},
   "outputs": [],
   "source": [
    "test_pred = test.assign(\n",
    "    cate_1 = m1.predict(test) - m1.predict(test.assign(T=test[\"T\"]-1)),\n",
    "    cate_2 = m2.predict(test) - m2.predict(test.assign(T=test[\"T\"]-1))\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "945b269f",
   "metadata": {},
   "source": [
    "Once we have those CATE predictions, we can evaluate them using the cumulative elasticity curve"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "f2605203",
   "metadata": {},
   "outputs": [],
   "source": [
    "cumelast_1 = cumulative_gain(test_pred, \"cate_1\", \"Y\", \"T\", steps=100)\n",
    "cumelast_2 = cumulative_gain(test_pred, \"cate_2\", \"Y\", \"T\", steps=100)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "2d2407dc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXgAAAD4CAYAAADmWv3KAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAABQc0lEQVR4nO3dd3hURdvA4d+kN5JAeiX0EiCU0IuA0gRREOlIEfC1gKiIfnZf9bX3giICoghIURBBpfcaCL0lkJAAqUAgCSmbzPfHSUICSVhCtmQz93XtlezZ3XOew4ZnZ+fMPCOklCiKoiiWx8rUASiKoiiGoRK8oiiKhVIJXlEUxUKpBK8oimKhVIJXFEWxUDamDqA4T09PGRISYuowFEVRqoyIiIgUKaVXaY+ZVYIPCQlh3759pg5DURSlyhBCxJb1mOqiURRFsVAqwSuKolgoleAVRVEslErwiqIoFkoleEVRFAulEryiKIqFUgleURTFQqkEr1QvUsLBRRCv5lsols9gCV4I0UgIEVnsdlUIMc1Qx1OU28rLhRVPw++Pw+x74Y+nID3Z1FEpisEYbCarlPIk0BJACGENnAd+N9TxFAWA7HSwcwYhSm7PugpLxkL0Bug6HfJzYee3cPxPeOBzaDa47H1Kqd2s1BdepWoxVqmCe4FoKWWZU2oV5a6lRsN3XcDFB1qOhOZD4FoCRK2Ho8vhciwM/ApaP6o9v+VoWPk0LHs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YDrNHWjrC093ke0PembWW9r/2ABgW3ycDMih60Sid4ii3sLaXMAQoX9rYoUsqLUsr9Bb9fQ/tPH4B2rj8VPO0n4CGTBGggQohAoD8wu+C+AHoCSwueYlHnLIRwA7oBPwJIKXOklFew8PcZraqtoxDCBnACLmJh77OUcgtw6abNZb2vDwLzpWYX4C6E8KvIcat6gg8A4ordjy/YZrGEECFAK2A34COlvFjwUALgY6q4DORzYAaQX3DfA7hSsJgMWN77XQdIBuYWdEvNFkI4Y8Hvs5TyPPAxcA4tsacBEVj2+1yorPe10vJaVU/w1YoQwgVYBkyTUl4t/pjUxrtazJhXIcQAIElKGWHqWIzIBmgNzJRStgIyuKk7xgLf55poLdY6gD/gzK1dGRbPUO9rVU/w1WZhbyGELVpyXyClXF6wObHwq1vBzyRTxWcAnYGBQogYtK63nmj90+4FX+XB8t7veCBeSrm74P5StIRvye/zfcBZKWWylDIXWI723lvy+1yorPe10vJaVU/w1WJh74K+5x+B41LKT4s9tBIYW/D7WGCFsWMzFCnl/0kpA6WUIWjv6wYp5ShgIzCk4GmWds4JQJwQolHBpnuBY1jw+4zWNdNBCOFU8HdeeM4W+z4XU9b7uhJ4tGA0TQcgrVhXzp2RUlbpG3A/cAqIBl4xdTwGOscuaF/fDgGRBbf70fqk1wOngXVALVPHaqDz7w6sKvi9LrAHiAKWAPamjq+Sz7UlsK/gvf4DqGnp7zPwFnACOAL8DNhb2vsMLES7xpCL9k3tsbLeV0CgjQ6MBg6jjTCq0HFVqQJFURQLVdW7aBRFUZQyqASvKIpioVSCVxRFsVAqwSuKolgoleAVRVEslErwiqIoFkoleEVRFAv1/8+kMZhjFJ+HAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(range(len(cumelast_1)), cumelast_1, label=\"M1\")\n",
    "plt.plot(range(len(cumelast_2)), cumelast_2, label=\"M2\")\n",
    "plt.plot([0, 100], [0, elast(test_pred, \"Y\", \"T\")], linestyle=\"--\", label=\"Random Model\", color=\"black\")\n",
    "plt.legend()\n",
    "plt.ylabel(\"Cumulative Elasticity\");"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "10ac5842",
   "metadata": {},
   "source": [
    "As we can see, now $M1$ is much worse than $M2$, even though it has a higher $R^2$ on the test set. This shows that predictive power doesn't translate directly to a good causal model, even if we use random data."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4e6aab85",
   "metadata": {},
   "source": [
    "## Predictive Metric For Causal Inference\n",
    " \n",
    "This doesn't mean we can't come up with a way to correctly evaluate a causal model using predictive metrics. In order to do so, let's go back to our additive assumption about de DGP.\n",
    " \n",
    "$$\n",
    "Y = g(x) + f(t,x)\n",
    "$$\n",
    " \n",
    "To use a predictive metric, we need to somehow transform the outcome in order to remove the $g(x)$ component from it. That way, all the remaining predictive power will necessarily be used to learn the causal relationship.\n",
    " \n",
    "$$\n",
    "\\tilde{Y} = Y - g(x) = f(t,x)\n",
    "$$\n",
    " \n",
    "One way of doing that is by orthogonalizing $Y$. We can use any ML model to estimate $g$ and get out of fold residuals\n",
    " \n",
    "$$\n",
    "\\tilde{Y} = Y - \\hat{g}(x)\n",
    "$$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "aa28a557",
   "metadata": {},
   "outputs": [],
   "source": [
    "denoise_m = smf.ols(\"Y~\"+\n",
    "                    \"+\".join([f\"w{f}\" for f in range(n_heter)])+\n",
    "                    \"+\"+\n",
    "                    \"+\".join([f\"f{f}\" for f in range(n_features)]), data=train).fit()\n",
    "\n",
    "test_res = test.assign(Y_res = test[\"Y\"] - denoise_m.predict(test) + test[\"Y\"].mean())"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f6302a6a",
   "metadata": {},
   "source": [
    "Once we do that, we can evaluate the power of each model in predicting the residualized outcome $\\tilde{Y}$. The predictive performance on this new outcome will directly translate to a better causal model."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "0c6ed700",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "M1: -281.7950185092476\n",
      "M2: -24.04912481654577\n"
     ]
    }
   ],
   "source": [
    "print(\"M1:\", r2_score(test_res[\"Y_res\"], m1.predict(test_res)))\n",
    "print(\"M2:\", r2_score(test_res[\"Y_res\"], m2.predict(test_res)))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "86f12479",
   "metadata": {},
   "source": [
    "The downside of this approach is that it depends on how well you can estimate $g(x)$."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "causal-glory",
   "language": "python",
   "name": "causal-glory"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
